home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_asm
/
nnansi3
/
nnansi.doc
< prev
next >
Wrap
Text File
|
1990-03-07
|
14KB
|
280 lines
nnansi - enhanced MS-DOS ansi console driver for EGA/VGA displays
SYNOPSIS
Include in \config.sys the line
device=nnansi.sys
DESCRIPTION
nnansi.sys is a NEW version of nansi.sys for the EGA/VGA display.
Its advantages over nansi.sys are:
1. It supports erase to start/end of screen control sequences.
2. It (optionally) scrolls by reprogramming the display controller
for 10-20x speed improvement dumping files to the display.
3. It understands display heights other than 25 and 43, thus is
useful in all extended EGA and VGA modes.
4. INT29 operation is typically 15% faster
5. Set Graphic Rendition reverse video now actually exchanges
foreground and background. In reverse video mode, changing the
background color alters the displayed foreground and visa-versa.
New code added to turn off bold and blink (and sorta turn off
"underline").
6. Some code cleanup has been performed (but not much)
7. There are more assembly options -- BE SURE TO LOOK AT NNANSI_D.ASM.
8. Graphic cursor can be disabled. Graphic cursor logic completely
changed -- BIOS set cursor position call will no longer leave
cursor ghosts. (Note that for some programs it will be necessary
to disable the graphics cursor; No cursor is the "standard", but
having the cursor is so much nicer that it is the default).
Compared to 1/8/89 version of NNANSI.SYS:
1. NNANSI is capable of writing characters directly to the screen
(without using the BIOS) in the 640x350 and 640x480 16 color modes,
and other 16 color modes with slight modification. This speeds up
character writing to 56% of NANSI's times.
2. Keyboard redefinition can be disabled.
3. Handling of the graphic cursor is somewhat better than before.
4. There are configuration options for several popular display cards
which allows improved performance in extended graphic or alpha
modes.
********BE SURE TO READ SECTION "BUGS" BELOW BEFORE USING!!!!
[What follows is a modified copy of the original nansi.sys
documentation]
nnansi.sys is a console driver which understands ANSI control
sequences. It has several advantages over ANSI.SYS (the driver
supplied with DOS):
1. It supports new escape sequences (see below).
2. It provides MUCH faster output under certain conditions.
3. It supports the 43-line mode of the EGA/VGA, and all EGA/VGA
extended modes (mode must be changed with other program). There
is now no need to use the vendor supplied nansi.sys drivers that
come with various display cards.
4. The darned bell is now 1/4 second instead of 1/2 second long.
What a console driver does:
When you, for example, type
C:> type foo.txt
COMMAND.COM opens the file foo.txt, reads it, and writes it to
the console driver, which puts it up on the screen.
Both ansi.sys and nnansi.sys use IBM Video BIOS to control the screen.
However, nnansi.sys bypasses BIOS if the screen is in a text mode or
16 color EGA/VGA graphic modes;
this allows much faster operation under certain conditions. Also
nnansi.sys scrolls by reprogramming the display start address rather
than moving all of the characters.
While putting text up on the screen, (nn)ansi.sys keeps a lookout for
the escape character (chr(27), known as ESC); this character signals
the start of a terminal control sequence.
Terminal control sequences follow the format
ESC [ param; param; ...; param cmd
where
ESC is the escape character chr$(27).
[ is the left bracket character.
param is an ASCII decimal number, or a string in quotes.
cmd is a case-specific letter identifying the command.
Usually, zero, one, or two parameters are given. If parameters
are omitted, they usually default to 1; however, some commands
(KKR and DKOCT) treat the no-parameter case specially.
Spaces are not allowed between parameters.
For example, both ESC[1;1H and ESC[H send the cursor to the home
position (1,1), which is the upper left.
Either single or double quotes may be used to quote a string.
Each character inside a quoted string is equivalent to one numeric
parameter. Quoted strings are normally used only for the Keyboard
Key Reassignment command.
Control Sequences
The following table lists the sequences understood by nnansi.sys.
Differences between nnansi.sys and the standard ansi.sys are marked
with a vertical bar (|).
Cursor Positioning
Short Long name Format Notes
CUP cursor position ESC[y;xH Sets cursor position.
HVP cursor position ESC[y;xf Same as CUP; not recommended.
CUU cursor up ESC[nA n = # of lines to move
CUD cursor down ESC[nB
CUF cursor forward ESC[nC n = # of columns to move
CUB cursor backward ESC[nD
DSR Device Status, Report! ESC[6n Find out cursor position.
CPR Cursor Position report ESC[y;xR Response to DSR, as if typed.
SCP Save Cursor Position ESC[s Not nestable.
RCP Restore Cursor Position ESC[u
Editing
ED | Erase in Display ESC[0J or ESC[J Clear to end of screen
| ESC[1J Clear to start of screen
ESC[2J Clears screen.
EL Erase in Line ESC[K Clears to end of line.
IL | Insert Lines ESC[nL Inserts n blank lines at cursor line.
DL | Delete Lines ESC[nM Deletes n lines including cursor line.
ICH | Insert Characters ESC[n@ Inserts n blank chars at cursor.
DCH | Delete Characters ESC[nP Deletes n chars including cursor char.
Mode-Setting
SGR Set Graphics Rendition ESC[n;n;...nm See character attribute table.
SM Set Mode ESC[=nh See screen mode table.
RM Reset Mode ESC[=nl See screen mode table.
IBMKKR Keyboard Key Reass. ESC["string"p
The first char of the string gives the key to redefine; the rest
of the string is the key's new value.
To specify unprintable chars, give the ASCII value of the char
outside of quotes, as a normal parameter.
IBM function keys are two byte strings; see the IBM Basic manual.
For instance, ESC[0;";dir a:";13;p redefines function key 1 to
have the value "dir a:" followed by the ENTER key.
| If no parameters given, all keys are reset to their default values.
DKOCT | Output char translate ESC[n;ny
| When first char is encountered in output request, it is replaced with
| the second char. This might be useful for previewing text before
| sending it to a printer with a funny print wheel.
| If no parameters are given, all chars are reset to normal.
Character Attributes
The Set Graphics Rendition command is used to select foreground
and background colors or attributes.
When you use multiple parameters, they are executed in sequence, and
the effects are cumulative.
Attrib code Value
0 All attributes off (normal white on black)
1 Bold
| 2 Dim (not Bold)
4 Underline (blue foreground)
5 Blink
7 Reverse Video
8 Invisible (but why?)
| 22 Cancel Bold
| 24 Cancel Underline (white foreground)
| 25 Cancel Blink
| 27 Normal, un-reversed video
30-37 foregnd blk/red/grn/yel/blu/magenta/cyan/white
40-47 background
Screen Modes
The IBM BIOS supports several video modes; the codes given in the
BIOS documentation are used as parameters to the Set Mode command.
| (In bitmap modes, the cursor is simulated with a small blob (^V).)
Mode Code Value
0 text 40x25 Black & White
1 text 40x25 Color
2 text 80x25 Black & White
3 text 80x25 Color
4 bitmap 320x200 4 bits/pixel
5 bitmap 320x200 1 bit/pixel
6 bitmap 640x200 1 bit/pixel
7 (cursor wrap kludge)
13 bitmap 320x200 4 bits/pixel
14 bitmap 640x200 4 bits/pixel
16 bitmap 640x350 4 bits/pixel
| 17 (VGA) bitmap 640x480 1 bit/pixel
| 18 (VGA) bitmap 640x480 4 bits/pixel
| 19 (VGA) bitmap 300x200 8 bits/pixel
| 99 (graphics cursor kludge)
Mode 7 is an unfortunate kludge; Setting mode 7 tells the cursor
to wrap around to the next line when it passes the end of a line;
Resetting mode 7 tells the cursor to not wrap, but rather stay put.
| Mode 99 enables the graphics mode cursor.
| NNANSI.SYS supports all EGA/VGA modes
| The EGA also lets you use a shorter character cell in text modes
| in order to squeeze 43 lines of text out of the 25-line text modes.
| To enter 43 line mode, set the desired 25-line text mode (0 to 3),
| then Set Mode 43. For instance: ESC[=3h ESC[=43h.
| To exit 43 line mode, set the desired 25-line text mode again.
| The driver supports all extended modes available with most EGA/VGA
| boards, such as 132 column modes and 60 line modes. These modes
| currently must be set by a vendor supplied program. (Why couldn't
| there be a standard for these??)
Faster Output
| Any program that sets the console to RAW mode, and buffers its
| output properly, can achieve extremely high screen update speeds in
| return for giving up the special functions of the keys ^C, ^S, and ^P.
| See IOCTL in the MS-DOS 3.x Technical Reference for more info.
Also, a small improvement in speed may be noticed with some
programs that use the DOS console in normal mode, as this driver
efficiently implements the (standard but undocumented) INT 29h
most-favored-device putchar used by DOS.
EXAMPLES
See the file setraw.doc for Macro Assembler, Lattice C,
and Microsoft C routines for entering and leaving raw mode.
BUGS
Insert and delete character do not work in graphics modes.
Tabs are expanded in RAW mode. This could also be viewed as a
feature, so I (Tom Almy) did not correct the problem.
Does not support some useful ANSI functions.
The Graphics Cursor may be incompatible with some graphics programs.
The cure is to turn the graphics cursor off.
The "fast" option in nnansi_d.asm (which is the default) scrolls the
display by reprogramming the display controller rather than moving
the contents of the display memory. While this is considerably
faster, most programs that access the display directly assume that
the display memory starts at B800:0 rather than using the starting
address stored at 40:4E. NNANSI resets the display starting address
to B800:0 whenever the BIOS is used to clear the display or return
the display mode. This seems to handle most programs, but
unfortunately there are some "dirty" programs out there that access
the display directly and never issue a BIOS call! These programs
can still usually be run by executing the DOS command CLS first.
Otherwise you will have to reassemble the driver with "fast EQU 0"
and take a major performance penalty. Known culprits include
PC-WRITE (except when used in 43 line mode), VP-PLANNER and PCTOOLS.
Some display cards set memory location 40:49H to other than 3 when in
a high resolution alpha mode. Unfortunately NNANSI considers these
modes to be graphic, and does not work properly. There exists a
compilation option for Paradise cards, which display this problem.
If your card displays this problem, but is not listed in the
nnansi_d.asm file, please send me a note.
VERSION
This is NNANSI.SYS version 11/89, by Tom Almy (toma@tekgvs.labs.tek.com).
It is a modification of:
NNANSI.SYS version 1/8/89, by Tom Almy
NANSI.SYS, version, 2.2, created February 1986. Problems should
be reported to Daniel Kegel, 1-60 CIT, Pasadena, CA 91126
(or, after June 1986, 2648 169th Ave SE, Bellevue, Wa. 98008).
Your suggestions for improvement would be most welcome.
NOTE
This program may be distributed for educational and personal use
only. Commercial use is verboten; get in touch with the author.
(Tom Almy places no restrictions on his modifications)
FILES
nnansi.sys - Driver, with compilation options set as shown
- in the source file nnansi_d.asm
*** YOU WILL PROBABLY WANT TO RECOMPILE WITH
YOUR CHOICES ***
nnansi.doc - this file
makefile - shows how to assemble & link
nnansi_d.asm - definitions **** READ THIS ****
nnansi.asm - device driver guts
nnansi_p.asm - ANSI parameter grabber
nnansi_f.asm - ANSI function handlers
nnansi_i.asm - device driver init routine
You can assemble with Microsoft MASM or Borland TASM. The makefile is for
NDMAKE and TASM.